import 'dart:collection';

class ClubMemberModel {
  String? imageUrl;
  int? grade;
  int? sex;
  String? nickname;
  List<GoodPosition>? goodPosition;
  String? clubRoleCode;
  String? clubRoleName;
  int? userId;

  ClubMemberModel(
      {this.imageUrl,
      this.grade,
      this.sex,
      this.nickname,
      this.goodPosition,
      this.clubRoleCode,
      this.clubRoleName,
      this.userId});

  ClubMemberModel.fromJson(Map<String, dynamic> json) {
    imageUrl = json['imageUrl'];
    grade = json['grade'];
    sex = json['sex'];
    nickname = json['nickname'];
    if (json['goodPosition'] != null) {
      goodPosition = <GoodPosition>[];
      json['goodPosition'].forEach((v) {
        if (v != null) {
            goodPosition!.add( GoodPosition.fromJson(v));
        }
      });
    }
    clubRoleCode = json['clubRoleCode'];
    clubRoleName = json['clubRoleName'];
    userId = json['userId'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = HashMap();
    data['imageUrl'] = imageUrl;
    data['grade'] = grade;
    data['sex'] = sex;
    data['nickname'] = nickname;
    if (goodPosition != null) {
      data['goodPosition'] = goodPosition!.map((v) => v.toJson()).toList();
    }
    data['clubRoleCode'] = clubRoleCode;
    data['clubRoleName'] = clubRoleName;
    data['userId'] = userId;
    return data;
  }
}

class GoodPosition {
  String? positionSortCode;
  String? positionSortDescription;
  String? subdivisionPosition;
  String? subdivisionPositionCode;

  GoodPosition(
      {this.positionSortCode,
      this.positionSortDescription,
      this.subdivisionPosition,
      this.subdivisionPositionCode});

  GoodPosition.fromJson(Map<String, dynamic> json) {
    positionSortCode = json['positionSortCode'];
    positionSortDescription = json['positionSortDescription'];
    subdivisionPosition = json['subdivisionPosition'];
    subdivisionPositionCode = json['subdivisionPositionCode'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = HashMap();
    data['positionSortCode'] = positionSortCode;
    data['positionSortDescription'] = positionSortDescription;
    data['subdivisionPosition'] = subdivisionPosition;
    data['subdivisionPositionCode'] = subdivisionPositionCode;
    return data;
  }
}